]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
StTextureCache: generate icon names in the right order
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 12 Mar 2011 22:27:57 +0000 (23:27 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Sun, 13 Mar 2011 13:46:42 +0000 (14:46 +0100)
GThemedIcon expects the first name to be the most specific, and
will thus prefer it to later ones. We thus need to order the names
from the longer to the shorter.

https://bugzilla.gnome.org/show_bug.cgi?id=621707

src/st/st-texture-cache.c

index 405cc177a3cd3d65d14e8e1ef6594a9fa0edc541..198ddf2734d3167b45a8192a105832f3705141d4 100644 (file)
@@ -1398,10 +1398,11 @@ static char **
 symbolic_names_for_icon (const char *name)
 {
   char **parts, **names;
-  int i;
+  int i, numnames;
 
   parts = g_strsplit (name, "-", -1);
-  names = g_new (char *, g_strv_length (parts) + 1);
+  numnames = g_strv_length (parts);
+  names = g_new (char *, numnames + 1);
   for (i = 0; parts[i]; i++)
     {
       if (i == 0)
@@ -1418,6 +1419,15 @@ symbolic_names_for_icon (const char *name)
   names[i] = NULL;
 
   g_strfreev (parts);
+
+  /* need to reverse here, because longest (most specific)
+     name has to come first */
+  for (i = 0; i < (numnames / 2); i++) {
+    char *tmp = names[i];
+    names[i] = names[numnames - i - 1];
+    names[numnames - i - 1] = tmp;
+  }
+
   return names;
 }